package com.yuedou.jylt.http

import java.lang.reflect.ParameterizedType

/**
 * Created by 俊华 on 17/8/12.
 */
interface NewCallBack<T> {
    /**
     * 失败的回调
     */
    fun onFail(err: String)
    /**
     * 成功的回调
     */
    fun onSuccess(t: T)

    /**
     * 获取接口传入的类型<T>
     */
    fun Type(): Class<T>? {
        val interfacesTypes = this.javaClass.genericInterfaces.get(0) as ParameterizedType
        return interfacesTypes.actualTypeArguments[0] as Class<T>
    }
}